package com.epoint.netty.future;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;

public class JDKFuture {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<Integer> integerFutureTask = new FutureTask<>(() -> {
            TimeUnit.SECONDS.sleep(3);
            return 55;
        });
        new Thread(integerFutureTask).start();

        System.out.println("main等待~~");
        Integer integer = integerFutureTask.get();
        System.out.println(integer);
    }
}
